home *** CD-ROM | disk | FTP | other *** search
- # mkpath path
- if !?argv[1]
- echo >&2 usage: mkpath pathname
- return 10
- endif
- local k i=0 tpath=argv[1] lpath[32]
- while strlen(tpath) > 0
- lpath[i++] = tpath
- if (k = rindex(tpath,'/')) >= 0
- tpath = left(tpath,k)
- else
- tpath = ""
- endif
- endwhile
-
- while i-- > 0
- if -d "$lpath[$i]"
- continue
- elseif -f "$lpath[$i]"
- echo object already exists: $1
- return 100
- endif
- mkdir $lpath[$i]
- endwhile
- # Mkpath is presented as is; no warrantee is either expressed or implied
- # as to it's suitability to any purpose whatsoever. You assume all the
- # risk for all damage, even if caused by a defect in the software,
- # no matter how awful.
-